package com.hzqy.service.epg;

import com.hzqy.persistence.dao.epg.AcConfigDao;
import com.hzqy.web.vo.epg.AcConfigVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.*;

@Service
public class AcConfigService {
	protected final Logger LOG = LoggerFactory.getLogger(getClass());
	@Resource
	private AcConfigDao acDao;
	public  Map<String,Object> selectAc(AcConfigVo acv, int page, int rows){
        Map<String,Object> map=new HashMap<String, Object>();
        map.put("f_ac_code", acv.getF_ac_code());
        map.put("f_ac_periods",acv.getF_ac_periods());
        map.put("f_ac_activityid", acv.getF_ac_activityid());
        map.put("beginDate", acv.getBeginDate());
        map.put("endDate", acv.getEndDate());
        Integer rowCount = acDao.selectAcCount(map);
        map.put("total", rowCount);
        if(rowCount>0 && page>0 && rows>0){
            map.put("firstResult", (page-1)*rows);
            map.put("maxResults", rows);
            List<AcConfigVo> list=acDao.selectAcByRequest(map);
            map.put("rows", list);
        }else{
            map.put("rows", new ArrayList<AcConfigVo>());
        }
        return map;
	}
    public Integer ConfigDataInsert(AcConfigVo acv){
        return acDao.insertConfig(acv);
    }

}
